package pub.guoxin.oops.manager.vo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import pub.guoxin.oops.model.AlarmDispose;
import pub.guoxin.oops.tidy.LocalDateTimeDeserializer;
import pub.guoxin.oops.tidy.LocalDateTimeSerializer;

import java.time.LocalDateTime;

/**
 * Create by guoxin on 2018/5/6
 */
@Data
public class AlarmDisposeVo {

    @ApiModelProperty("门站名称")
    private String groupName;

    @ApiModelProperty("设备串号")
    private String deviceSn;

    @ApiModelProperty("字段名称")
    private String fieldName;
    /**
     * 比较
     */
    @ApiModelProperty("比较运算符")
    private String comparisonOperator;
    /**
     * 数值
     */
    @ApiModelProperty("数值")
    private Object value;

    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime creation;

    @ApiModelProperty("地点")
    private String side;

    @ApiModelProperty("备注")
    private String remark;

    public AlarmDisposeVo(AlarmDispose alarmDispose, String groupName) {
        this.groupName = groupName;
        this.deviceSn = alarmDispose.getDeviceSn();
        this.fieldName = alarmDispose.getFieldName();
        this.comparisonOperator = alarmDispose.getComparisonOperator();
        this.creation = alarmDispose.getCreation();
        this.remark = alarmDispose.getRemark();
        this.side = "地点";
    }
}
